package com.hp.event;

import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.Event;
import se.mickelus.tetra.blocks.workbench.WorkbenchTile;
import se.mickelus.tetra.module.schematic.UpgradeSchematic;


public class WorkbenchTileSyncEvent extends Event {

    // 1. 定义私有字段来存储数据
    private final ItemStack targetStack;
    private final ItemStack upgradedStack;
    private final Player player;
    private final WorkbenchTile workbenchTile;
    private final ItemStack[] materials;
    private final ItemStack[] materialsAltered;
    private final UpgradeSchematic currentSchematic;
    private final String currentSlot;

    // 2. 在构造函数中初始化这些字段
    public WorkbenchTileSyncEvent(
            ItemStack targetStack,
            ItemStack upgradedStack,
            Player player,
            WorkbenchTile workbenchTile,
            ItemStack[] materials,
            ItemStack[] materialsAltered,
            UpgradeSchematic currentSchematic,
            String currentSlot
    ) {
        this.targetStack = targetStack;
        this.upgradedStack = upgradedStack;
        this.player = player;
        this.workbenchTile = workbenchTile;
        this.materials = materials;
        this.materialsAltered = materialsAltered;
        this.currentSchematic = currentSchematic;
        this.currentSlot = currentSlot;
    }

    // 3. 提供公共的 getter 方法，让监听器可以获取数据
    public ItemStack getTargetStack() { return targetStack; }
    public ItemStack getUpgradedStack() { return upgradedStack; }
    public Player getPlayer() { return player; }
    public WorkbenchTile getWorkbenchTile() { return workbenchTile; }
    public ItemStack[] getMaterials() { return materials; }
    public ItemStack[] getMaterialsAltered() { return materialsAltered; }
    public UpgradeSchematic getCurrentSchematic() { return currentSchematic; }
    public String getCurrentSlot() { return currentSlot; }
}